<template>
  <div class='game_currency_putaway'>
    <Row type='flex'
         justify='center'
         style="padding:60px 100px">
      <Col style="width: 1200px;">
      <Steps :current="current">
        <Step title="选择上架门店"
              class="prev"></Step>
        <Step title="完善商品信息"
              class="prev"></Step>
        <Step title="录入价格信息"
              class="prev"></Step>
        <Step title="完成"
              class="complate"></Step>
      </Steps>
      </Col>
    </Row>
    <div class="first-level content-style"
         v-show='current === 0'
         style="width: 850px">
      <div class="title">
        <p></p>
        <span>选择门店</span>
      </div>
      <Form ref="formValidate1"
            :model="formValidate1"
            :rules="ruleValidate1"
            :label-width="85"
            style="width: 850px;">
        <FormItem label="所属类型："
                  prop="involvedType">
          <Select v-model="formValidate1.involvedType"
                  @on-change="seletcType"
                  disabled
                  class='input-wid'
                  style="width: 260px">
            <Option v-for="(item, index) in involvedTypeList"
                    :value="item.typeCode"
                    :key="index">{{item.typeName}}</Option>
          </Select>
        </FormItem>
        <select-shop :checkdList="checkdList"
                     :dataTreeFormat="dataTreeFormat"
                     @selctshop="volumeSet"
                     @oncancel="oncancel"
                     id="involveds"
                     :dataTree="dataTree">
        </select-shop>
        <FormItem label="所属分类："
                  prop="involvedClassify">
          <div class="involveds-box"></div>
          <div class="shops">您当前选择的商品门店有：<div class="shop-items"
                 v-if="formValidate1.involvedClassify.length>0"><span v-for="(item,index) in formValidate1.involvedClassify"
                    :key="index">
                {{item.orgName}}{{(index===formValidate1.involvedClassify.length-1&&formValidate1.involvedClassify.length>1)?'':'、'}}
              </span></div>
          </div>
        </FormItem>
        <FormItem>
          <Button type="primary"
                  @click='submitOne'>下一步，选择商家门店</Button>
        </FormItem>
      </Form>
    </div>
    <!-- 第一步结束 -->
    <!-- 第二步开始 -->
    <div class="second-level content-style"
         v-show='current === 1'
         style="width: 850px">
      <div class="title">
        <p></p>
        <span>商品信息</span>
      </div>
      <Form inline
            ref="formValidate2"
            :model="formValidate2"
            :rules="ruleValidate2"
            :label-width="85"
            style="width: 850px;">
        <FormItem label="商品分类："
                  prop="productClassify">
          <Input v-model="formValidate2.productClassify"
                 placeholder="请输入"
                 style="width: 118px"
                 disabled></Input>
          <span style="color:#DCDEE2;margin: 0 8px">-</span>
          <Input v-model="formValidate2.productClassify2"
                 placeholder="请输入"
                 style="width: 118px"
                 disabled></Input>
          <!-- <span style="color: #2D8CF0;margin-left: 8px;cursor:pointer"
                @click='skipTwo'>编辑</span> -->
        </FormItem>
        <FormItem label="是否虚拟商品："
                  prop="goodsType"
                  :label-width='180'>
          <RadioGroup v-model="formValidate2.goodsType"
                      size="large">
            <Radio :label="1"
                   disabled>是</Radio>
            <Radio :label="0"
                   disabled
                   style="margin-left:50px">否</Radio>
          </RadioGroup>
        </FormItem>
        <FormItem label="所属类型："
                  prop="relateType">
          <Select v-model="formValidate2.relateType"
                  @on-change="seletcType"
                  disabled
                  class='input-wid'
                  style="width: 260px">
            <Option v-for="(item, index) in involvedTypeList"
                    :value="item.typeCode"
                    :key="index">{{item.typeName}}</Option>
          </Select>
        </FormItem>
        <FormItem label="对应分类："
                  prop="matchClassify"
                  :label-width='180'>
          <Select v-model="formValidate2.matchClassify"
                  @on-change="seletcType2"
                  disabled
                  class='input-wid'
                  style='width:255px'>
            <Option v-for="(item, index) in matchClassifyList"
                    :value="item.typeCode"
                    :key="index">{{item.typeName}}</Option>
          </Select>
        </FormItem>
        <Row>
          <FormItem label="套餐类型："
                    prop="mealType"
                    v-if="typeLen===3"
                    :label-width='85'>
            <Select v-model="formValidate2.mealType"
                    @on-change="seletcType3"
                    disabled
                    class='input-wid'
                    style='width:255px'>
              <Option v-for="(item, index) in mealTypeList"
                      :value="item.typeCode"
                      :key="index">{{item.typeName}}</Option>
            </Select>
          </FormItem>
        </Row>
        <FormItem label="商品标题："
                  prop="subTitle"
                  :label-width='85'>
          <Input v-model="formValidate2.subTitle"
                 :maxlength="24"
                 placeholder="请输入"
                 style="width: 255px"></Input>
        </FormItem>
        <FormItem label="商品名称："
                  prop="skuName"
                  :label-width='180'>
          <Input v-model="formValidate2.skuName"
                 :maxlength="12"
                 disabled
                 placeholder="请输入"
                 style="width: 255px"></Input>
        </FormItem>
        <FormItem label="商品条码："
                  prop="barcode"
                  :label-width='85'>
          <Input v-model="formValidate2.barcode"
                 :maxlength="13"
                 disabled
                 @on-keyup="keyup"
                 placeholder="请输入"
                 style="width: 255px"></Input>
        </FormItem>
        <FormItem label="商品编码："
                  prop="skuId"
                  :label-width='180'>
          <Input v-model="formValidate2.skuId"
                 placeholder="请输入"
                 disabled
                 style="width: 255px"></Input>
        </FormItem>
        <FormItem label="商品单位："
                  prop="goodsUnit"
                  :label-width='85'>
          <Select v-model="formValidate2.goodsUnit"
                  class='input-wid'
                  disabled
                  style='width:255px'>
            <Option v-for="(item, index) in goodsUnitList"
                    :value="item.value"
                    :key="index">{{item.label}}</Option>
          </Select>
        </FormItem>
        <FormItem label="游戏币数量："
                  prop="coinNum"
                  v-if="formValidate2.mealType==='010401'"
                  :label-width='180'>
          <Input v-model="formValidate2.coinNum"
                 disabled
                 placeholder="请输入"
                 style="width: 255px"></Input>
        </FormItem>
        <FormItem label="商品数量："
                  prop="goodsNum"
                  v-if="formValidate2.matchClassify==='0102'"
                  :label-width='180'>
          <Input v-model="formValidate2.goodsNum"
                 disabled
                 placeholder="请输入"
                 style="width: 255px"></Input>
        </FormItem>
        <Row v-if="formValidate2.matchClassify==='0102'">
          <FormItem label="兑换数量："
                    prop="exchangeNum"
                    :label-width='85'>
            <Input v-model="formValidate2.exchangeNum"
                   @on-keyup="exchangeNumkeyup"
                   disabled
                   @on-blur="exchangeNumblur"
                   :maxlength="6"
                   placeholder="请输入"
                   style="width: 255px"></Input>
          </FormItem>
        </Row>
        <Row>
          <FormItem label="上传图片："
                    prop="thumbnail"
                    :label-width='85'>
            <upload-only :imgUrl.sync="formValidate2.thumbnail"></upload-only>
          </FormItem>
        </Row>
        <!-- 上传图片 -->
        <Row v-if="goodsDetail.length>0">
          <div class="title">
            <p></p>
            <span>商品详情</span>
          </div>
          <Form :label-width="85"
                ref="formDynamic"
                :model="formDynamic">
            <Row v-for="(item,idx) in formDynamic.list"
                 :key="idx">
              <div class="child-items">子商品{{idx+1}}</div>
              <Row>
                <FormItem label="商品名称："
                          :prop="'list.'+idx+'.skuName'"
                          :rules="[{required: true, message: '商品名称不能为空', trigger: 'blur'}]"
                          :label-width='85'>
                  <Input v-model="item.skuName"
                         placeholder="请输入"
                         disabled
                         style="width: 255px"></Input>
                </FormItem>
                <FormItem label="销售形式："
                          :prop="'list.'+idx+'.saleType'"
                          v-if="item.goodsKindList[1].typeCode==='0201'||item.goodsKindList[1].typeCode==='0202'"
                          :rules="[{required: true, message: '销售形式不能为空'}]"
                          :label-width='180'>
                  <Input :value="['打包销售','单独销售'][item.saleType]"
                         placeholder="请输入"
                         disabled
                         style="width: 255px"></Input>
                </FormItem>
              </Row>
              <FormItem label="所属类型："
                        :prop="'list.'+idx+'.relateType'"
                        :rules="[{required: true, message: '所属类型不能为空', trigger: 'blur'}]"
                        :label-width='85'>
                <Input v-model="item.relateType"
                       placeholder="请输入"
                       disabled
                       style="width: 255px"></Input>
              </FormItem>
              <FormItem label="对应分类："
                        :prop="'list.'+idx+'.matchClassify'"
                        :rules="[{required: true, message: '对应分类不能为空', trigger: 'blur'}]"
                        :label-width='180'>
                <Input v-model="item.matchClassify"
                       placeholder="请输入"
                       disabled
                       style="width: 255px"></Input>
              </FormItem>
              <FormItem label="商品编码："
                        :prop="'list.'+idx+'.skuId'"
                        :rules="[{required: true, message: '商品编码不能为空', trigger: 'blur'}]"
                        :label-width='85'>
                <Input v-model="item.skuId"
                       disabled
                       placeholder="请输入"
                       style="width: 255px"></Input>
              </FormItem>
              <FormItem label="商品条码："
                        :prop="'list.'+idx+'.barcode'"
                        :rules="[{required: true, message: '商品条码不能为空', trigger: 'blur'}]"
                        :label-width='180'>
                <Input v-model="item.barcode"
                       disabled
                       :maxlength="13"
                       placeholder="请输入"
                       style="width: 255px"></Input>
              </FormItem>
              <Row>
                <FormItem label="商品数量："
                          v-if="item.goodsKindList[1].typeCode!=='0101'"
                          :rules="[{required: true, message: '商品数量不能为空'}]"
                          :prop="'list.'+idx+'.num'"
                          :label-width='85'>
                  <Input :value="item.num"
                         disabled
                         placeholder="请输入"
                         style="width: 255px"></Input>
                </FormItem>
                <FormItem label="商品单位："
                          :prop="'list.'+idx+'.goodsUnit'"
                          :rules="[{required: true, message: '商品单位不能为空'}]"
                          :label-width="item.goodsKindList[1].typeCode==='0101'?85:180">
                  <Input :value="['个','枚','份'][item.goodsUnit]"
                         disabled
                         style="width: 255px"></Input>
                </FormItem>
              </Row>
              <FormItem label="商品价："
                        :prop="'list.'+idx+'.goodsPrice'"
                        v-if="item.goodsKindList[1].typeCode==='0201'||item.goodsKindList[1].typeCode==='0202'"
                        :rules="[{required: true, message: '商品价不能为空', trigger: 'blur'}]"
                        :label-width='85'>
                <Input :value="item.goodsPrice"
                       disabled
                       placeholder="请输入"
                       style="width: 255px"></Input><span style="padding:0 10px;">元</span>
              </FormItem>
              <FormItem label="游戏币数量："
                        :prop="'list.'+idx+'.num'"
                        :rules="[{required: true, message: '游戏币数量不能为空'}]"
                        v-if="item.goodsKindList[1].typeCode==='0101'"
                        :label-width='100'>
                <Input :value="item.num"
                       disabled
                       style="width: 255px"></Input><span style="padding:0 10px;">枚</span>
              </FormItem>
              <FormItem label="局数："
                        :prop="'list.'+idx+'.games'"
                        :rules="[{required: true, message: '局数不能为空', trigger: 'blur'}]"
                        v-if="item.goodsKindList[1].typeCode==='0201'||item.goodsKindList[1].typeCode==='0202'"
                        :label-width='150'>
                <Input :value="item.games"
                       disabled
                       style="width: 255px"></Input><span style="padding:0 10px;">局</span>
              </FormItem>
            </Row>
          </Form>
        </Row>
        <Row v-if="goodsDetail2.length>0">
          <div class="title">
            <p></p>
            <span>商品详情</span>
          </div>
          <Form :label-width="85"
                ref="formDynamic"
                :model="formDynamic">
            <Row v-for="(item,idx) in formDynamic.list"
                 :key="idx">
              <select-machine :checkdList="item.project"
                              :dataTree="shopProjects"
                              :modalShow="item.modalShow"
                              @oncancel="selctshopCancelm(item)"
                              @selctshop="volumeSetm(...arguments,item)"
                              v-if="item.modalShow">
              </select-machine>
              <div class="child-items">子商品{{idx+1}}</div>
              <Row>
                <FormItem label="商品名称："
                          :prop="'list.'+idx+'.skuName'"
                          :rules="[{required: true, message: '商品名称不能为空', trigger: 'blur'}]"
                          :label-width='85'>
                  <Input v-model="item.skuName"
                         placeholder="请输入"
                         disabled
                         style="width: 255px"></Input>
                </FormItem>
                <FormItem label="销售形式："
                          :prop="'list.'+idx+'.saleType'"
                          v-if="item.goodsKindList[1].typeCode==='0201'||item.goodsKindList[1].typeCode==='0202'"
                          :rules="[{required: true, message: '销售形式不能为空'}]"
                          :label-width='180'>
                  <Input :value="['打包销售','单独销售'][item.saleType]"
                         placeholder="请输入"
                         disabled
                         style="width: 255px"></Input>
                </FormItem>
              </Row>
              <FormItem label="所属类型："
                        :prop="'list.'+idx+'.relateType'"
                        :rules="[{required: true, message: '所属类型不能为空', trigger: 'blur'}]"
                        :label-width='85'>
                <Input v-model="item.relateType"
                       placeholder="请输入"
                       disabled
                       style="width: 255px"></Input>
              </FormItem>
              <FormItem label="对应分类："
                        :prop="'list.'+idx+'.matchClassify'"
                        :rules="[{required: true, message: '对应分类不能为空', trigger: 'blur'}]"
                        :label-width='180'>
                <Input v-model="item.matchClassify"
                       placeholder="请输入"
                       disabled
                       style="width: 255px"></Input>
              </FormItem>
              <FormItem label="商品编码："
                        :prop="'list.'+idx+'.skuId'"
                        :rules="[{required: true, message: '商品编码不能为空', trigger: 'blur'}]"
                        :label-width='85'>
                <Input v-model="item.skuId"
                       disabled
                       placeholder="请输入"
                       style="width: 255px"></Input>
              </FormItem>
              <FormItem label="商品条码："
                        :prop="'list.'+idx+'.barcode'"
                        :rules="[{required: true, message: '商品条码不能为空', trigger: 'blur'}]"
                        :label-width='180'>
                <Input v-model="item.barcode"
                       disabled
                       :maxlength="13"
                       placeholder="请输入"
                       style="width: 255px"></Input>
              </FormItem>
              <Row>
                <FormItem label="商品数量："
                          v-if="item.goodsKindList[1].typeCode!=='0101'"
                          :rules="[{required: true, message: '商品数量不能为空'}]"
                          :prop="'list.'+idx+'.num'"
                          :label-width='85'>
                  <Input :value="item.num"
                         disabled
                         placeholder="请输入"
                         style="width: 255px"></Input>
                </FormItem>
                <FormItem label="商品单位："
                          :prop="'list.'+idx+'.goodsUnit'"
                          :rules="[{required: true, message: '商品单位不能为空'}]"
                          :label-width="item.goodsKindList[1].typeCode==='0101'?85:180">
                  <Input :value="['个','枚','份'][item.goodsUnit]"
                         disabled
                         style="width: 255px"></Input>
                </FormItem>
              </Row>
              <FormItem label="商品价："
                        :prop="'list.'+idx+'.goodsPrice'"
                        v-if="item.goodsKindList[1].typeCode==='0201'||item.goodsKindList[1].typeCode==='0202'"
                        :rules="[{required: true, message: '商品价不能为空', trigger: 'blur'}]"
                        :label-width='85'>
                <Input :value="item.goodsPrice"
                       disabled
                       placeholder="请输入"
                       style="width: 255px"></Input><span style="padding:0 10px;">元</span>
              </FormItem>
              <FormItem label="游戏币数量："
                        :prop="'list.'+idx+'.num'"
                        :rules="[{required: true, message: '游戏币数量不能为空'}]"
                        v-if="item.goodsKindList[1].typeCode==='0101'"
                        :label-width='100'>
                <Input :value="item.num"
                       disabled
                       style="width: 255px"></Input><span style="padding:0 10px;">枚</span>
              </FormItem>
              <FormItem label="局数："
                        :prop="'list.'+idx+'.games'"
                        :rules="[{required: true, message: '局数不能为空', trigger: 'blur'}]"
                        v-if="item.goodsKindList[1].typeCode==='0201'||item.goodsKindList[1].typeCode==='0202'"
                        :label-width='150'>
                <Input :value="item.games"
                       disabled
                       style="width: 255px"></Input><span style="padding:0 10px;">局</span>
              </FormItem>
              <FormItem label="可选项目："
                        :prop="'list.'+idx+'.project'"
                        class="tag-form"
                        :rules="[{required: true, message: '可选项目不能为空'}]"
                        :label-width='85'
                        v-if="item.goodsKindList[1].typeCode==='0201'||item.goodsKindList[1].typeCode==='0202'"
                        style="width: 800px">
                <div class="tag-container"
                     @click="selectProject(item)">
                  <Row type="flex"
                       style="width: 100%">
                    <Col span="23">
                    <Tag v-for="(its, index) in item.project"
                         :key="index"
                         :name="index"
                         @click.native="selectProject(its)"
                         closable
                         @on-close="deleteProject(...arguments,item.project,its,index,item,idx)">{{ its.name }}</Tag>
                    </Col>
                    <Col span="1"
                         class="tag-flex">
                    <Icon type="ios-search"
                          style="font-size: 18px" />
                    </Col>
                  </Row>
                </div>
              </FormItem>
              <Row>
                <FormItem label="项目设置："
                          :prop="'list.'+idx+'.projectItems'"
                          :rules="[{required: true, message: '项目设置不能为空'}]"
                          v-if="(item.goodsKindList[1].typeCode==='0201'&&item.project.length)"
                          :label-width='85'>
                  <!-- <Form class="project-items"
                  ref="formDynamic"
                  :model="formDynamic"
                  :label-width="120"> -->
                  <!-- <FormItem :label="item.machineName"
                        v-for="(item,idx) in formDynamic.list"
                        :key="idx"
                        :prop="'list.' + idx + '.value'"
                        class="project-items-le"> -->
                  <div class="project-items">
                    <div class="project-items-its"
                         v-for="(its,idx) in item.projectItems"
                         :key="idx">
                      <div class="project-items-items">{{its.machineName}}</div>
                      <Input style="width:96px;"
                             placeholder="请输入"
                             :maxlength="6"
                             @on-keyup="projectItemskeyup(its.count,its)"
                             @on-blur="projectItemsblur(its.count,its)"
                             v-model="its.count"></Input><span style="padding:0 10px;">局</span>
                    </div>
                  </div>
                </FormItem>
              </Row>
              <Row v-if="item.goodsKindList[1].typeCode==='0202'">
                <FormItem label="每天使用局数限制："
                          :prop="'list.'+idx+'.dailyUseLimit'"
                          :rules="[{required: true, message: '局数限制不能为空', trigger: 'blur'}]"
                          :label-width='140'>
                  <Input v-model="item.dailyUseLimit"
                         :maxlength="6"
                         @on-keyup="dailyUsekeyup(item.dailyUseLimit,item)"
                         @on-blur="dailyUseblur(item.dailyUseLimit,item)"
                         placeholder="请输入"
                         style="width: 255px"></Input><span style="padding:0 10px;">局</span>
                </FormItem>
              </Row>
              <Row v-if="item.goodsKindList[1].typeCode==='0201'||item.goodsKindList[1].typeCode==='0202'">
                <FormItem label="有效期："
                          :prop="'list.'+idx+'.validType'"
                          :rules="[{required: true, message: '有效期不能为空', trigger: 'change'}]"
                          :label-width='85'>
                  <Select v-model="item.validType"
                          class='input-wid'
                          style='width:255px'>
                    <Option v-for="(item, index) in timesList"
                            :value="item.id"
                            :key="index">{{item.value}}</Option>
                  </Select>
                </FormItem>
                <FormItem label="时长："
                          :prop="'list.'+idx+'.validDays'"
                          :rules="[{required: true, message: '时长不能为空', trigger: 'blur'}]"
                          v-if="item.validType==='2'"
                          :label-width='180'>
                  <Input v-model="item.validDays"
                         placeholder="请输入"
                         :maxlength="6"
                         @on-keyup="validDayskeyup(item.validDays,item)"
                         @on-blur="validDaysblur(item.validDays,item)"
                         style="width: 255px"></Input><span style="padding:0 10px;">天</span>
                </FormItem>
              </Row>
              <Row v-if="item.goodsKindList[1].typeCode==='0201'||item.goodsKindList[1].typeCode==='0202'">
                <FormItem label="开始时间："
                          :prop="'list.'+idx+'.validStart'"
                          :rules="[{required: true, message: '请选择开始时间'}]"
                          v-if="item.validType==='1'"
                          :label-width='85'>
                  <DatePicker type="date"
                              :editable="editable"
                              v-model="item.validStart"
                              @on-change="validStartChange"
                              :options="validStartOptions"
                              placeholder="请选择"
                              style="width: 255px"></DatePicker>
                </FormItem>
                <FormItem label="结束时间："
                          :prop="'list.'+idx+'.validEnd'"
                          :rules="[{required: true, message: '请选择结束时间'}]"
                          v-if="item.validType==='1'"
                          :label-width='180'>
                  <DatePicker type="date"
                              :editable="editable"
                              v-model="item.validEnd"
                              @on-change="validEndChange"
                              :options="validEndOptions"
                              placeholder="请选择"
                              style="width: 255px"></DatePicker>
                </FormItem>
              </Row>
            </Row>
          </Form>
        </Row>
        <Row>
          <FormItem>
            <div style="margin-top: 20px">
              <Button class="btn"
                      @click="skipTwo">上一步，选择商家门店</Button>
              <Button type="primary"
                      class="btn"
                      style="margin-left: 24px"
                      @click="submitTwo">下一步，录入价格信息</Button>
            </div>
          </FormItem>
        </Row>
      </Form>
    </div>
    <!-- 第二步结束 -->
    <div class="third-level content-style"
         v-show='current === 2'
         style="width: 910px;">
      <div class="title">
        <p></p>
        <span>价格信息</span>
      </div>
      <Form inline
            ref="formValidate3"
            :model="formValidate3"
            :rules="ruleValidate3"
            :label-width="95"
            style="width: 850px;">
        <Row>
          <FormItem label="销售渠道："
                    prop="qdName"
                    :label-width='85'>
            <Input v-model="formValidate3.qdName"
                   disabled
                   placeholder="请输入"
                   style="width: 255px"></Input>
          </FormItem>
        </Row>
        <!-- <FormItem label="商品价格："
                  prop="qdName"
                  :label-width='85'>
          <Input v-model="formValidate3.qdName"
                 placeholder="请输入"
                 style="width: 255px"></Input><span style="padding:0 10px;">元</span>
        </FormItem> -->
        <FormItem label="平台价格："
                  prop="ptPrice"
                  :label-width='85'>
          <Input v-model="formValidate3.ptPrice"
                 :maxlength="10"
                 @on-keyup="ptPricekeyup"
                 @on-blur="ptPriceblur"
                 placeholder="请输入"
                 style="width: 255px"></Input><span style="padding:0 10px;">元</span>
        </FormItem>
        <Row>
          <FormItem label="可售库存："
                    prop="inventory"
                    :rules="{required:unlimited?false:true,message:'请输入可售库存'}"
                    :label-width='85'>
            <Input v-model="formValidate3.inventory"
                   placeholder="请输入"
                   :disabled="unlimited"
                   :maxlength="6"
                   @on-keyup="inventorykeyup"
                   @on-blur="inventoryblur"
                   style="width: 255px"></Input>
            <Checkbox v-model="unlimited"
                      style="padding-left:10px;">不限</Checkbox>
          </FormItem>
        </Row>
        <FormItem label="上架时间："
                  prop="listingAt"
                  :label-width='85'>
          <DatePicker type="datetime"
                      :editable="editable"
                      :options="listingTimeOptions"
                      @on-change="listingTimeChange"
                      v-model="formValidate3.listingAt"
                      placeholder="请选择"
                      style="width: 255px"></DatePicker>
        </FormItem>
        <FormItem label="下架时间："
                  prop="delistingAt"
                  :label-width='180'>
          <DatePicker type="datetime"
                      :editable="editable"
                      :options="delistingTimeOptions"
                      @on-change="delistingTimeChange"
                      v-model="formValidate3.delistingAt"
                      placeholder="请选择"
                      style="width: 255px"></DatePicker>
        </FormItem>
        <div class="title"
             v-if="formValidate2.matchClassify==='0101'"
             style="margin-top:80px;">
          <p></p>
          <span>售卖规则</span>
        </div>
        <FormItem label="购买最少限制："
                  v-if="formValidate2.matchClassify==='0101'"
                  prop="minNum"
                  :label-width='120'>
          <Input v-model="formValidate3.minNum"
                 :maxlength="6"
                 @on-keyup="inventorykeyup"
                 @on-blur="inventoryblur"
                 placeholder="请输入"
                 style="width: 255px"></Input>
        </FormItem>
        <Row>
          <FormItem>
            <div style="margin-top: 20px">
              <Button class="btn"
                      @click="skipThree">上一步，完善商品信息</Button>
              <Button type="primary"
                      class="btn"
                      style="margin-left: 24px"
                      @click="submitThree">下一步，完成商品上下架</Button>
            </div>
          </FormItem>
        </Row>
      </Form>
    </div>
    <div class="four-level content-style"
         style="width: 120px;text-align: center;padding-top: 50px"
         v-show='current === 3'>
      <div style="color: #18BE6B;">
        <Icon type="ios-checkmark-circle-outline"
              size='35' />
      </div>
      <h3 style="margin: 10px 0 50px 0">完成商品添加({{num}}秒)</h3>
      <Button type="primary"
              @click='skipList'>返回商品列表</Button>
    </div>
  </div>
</template>
<script>
import SelectShop from '@/view/components/select-upshop/select-upshop.vue'
import { getOrgAllTree } from '@/api/system/org'
import UploadOnly from '@/view/components/upload-only/index.vue'
import { getDetailSysGoodsList, createChannelList, getMachineList } from '@/api/merchandise/index'
import SelectMachine from '@/view/components/select-project/index.vue'
import dayjs from 'dayjs'
// import { getGoodsDetail } from '@/api/goods/index'
export default {
  name: 'game_currency_putaway',
  components: { SelectShop, UploadOnly, SelectMachine },
  data () {
    return {
      current: 0, // 步骤
      num: 3,
      typeLen: '',
      editable: false,
      subTrue: true,
      timer: '', // 时间
      dataTree: [], // 门店树
      dataTreeFormat: [], // 门店列表
      checkdList: [], // 已选门店
      packagesArr: [],
      formValidate1: {
        involvedType: '',
        involvedClassify: []
      },
      involvedTypeList: [],
      involvedTypeList2: [],
      matchClassifyList2: [],
      deletIndex: '',
      ids: [],
      shopProjects: [], // 机台
      timesList: [
        { id: '2', value: '相对时间' },
        { id: '1', value: '时间段' }
      ],
      ruleValidate1: {
        involvedType: { required: true, message: '请选择所属类型', trigger: 'change' },
        involvedClassify: {
          required: true,
          type: 'array',
          trigger: 'change',
          validator: (rule, value, callback) => {
            if (value.length > 0) {
              callback()
            } else {
              callback(new Error('请选择商品门店'))
            }
          }
        }
      },
      matchClassifyList: [], // 对应分类列表
      mealTypeList: [], // 套餐类型
      projectList: [
        { id: '1', value: '名称一' },
        { id: '2', value: '名称二' },
        { id: '3', value: '名称三' },
        { id: '4', value: '名称四' },
        { id: '5', value: '名称五' }
      ], // 可选项目列表
      goodsUnitList: [ // 商品单位列表
        { value: 0, label: '个' },
        { value: 1, label: '枚' },
        { value: 2, label: '份' }
      ],
      goodsDetail: [], // 子商品列表
      goodsDetail2: [], // 混合套餐
      formDynamic: { list: [] },
      validStartOptions: {
      },
      validEndOptions: {
        disabledDate (date) {
          return date.valueOf() < Date.now() - 86400000
        }
      },
      listingTimeOptions: {},
      delistingTimeOptions: {
        disabledDate (date) {
          return date.valueOf() < Date.now() - 86400000
        }
      },
      formValidate2: {
        productClassify: '',
        productClassify2: '',
        goodsType: '', // 商品类型
        relateType: '', // 所属类型
        matchClassify: '', // 对应分类
        mealType: '', // 套餐类型
        subTitle: '', // 商品标题
        skuName: '', // 商品名称
        exchangeNum: '', // 兑换数量
        barcode: '', // 商品条码
        skuId: '', // 商品编码
        goodsUnit: null, // 商品单位
        goodsNum: '', // 商品数量
        coinNum: '', // 游戏币数量
        thumbnail: '', // 上传图片
        shopNameItems: '',
        shopNameItems2: '', // 商品名称
        relateType2: '',
        matchClassify2: '',
        barcode2: '',
        skuId2: '',
        goodsNum2: '',
        coinNum2: '',
        goodsUnit2: '',
        goodsPrice2: '', // 商品价
        timesId: '', // 局数
        saleType: '', // 销售形式
        project: '' // 项目id
      },
      modalShow: false,
      ruleValidate2: {
        productClassify: { required: true, message: '请输入商品分类', trigger: 'blue' },
        goodsType: { required: true, message: '请选择是否虚拟商品', trigger: 'change', type: 'number' },
        relateType: { required: true, message: '请选择所属类型', trigger: 'change' },
        exchangeNum: { required: true, message: '兑换数量不能为空', trigger: 'blur' },
        matchClassify: { required: true, message: '请选择对应分类', trigger: 'change' },
        coinNum: { required: true, message: '游戏币数量不能为空', trigger: 'blur', type: 'number' },
        mealType: { required: true, message: '请选择套餐类型', trigger: 'change' },
        subTitle: { required: true, message: '商品标题不能为空', trigger: 'blur' },
        skuName: { required: true, message: '请输入商品名称', trigger: 'blur' },
        barcode: { required: true, message: '请输入商品条码', trigger: 'blur' },
        skuId: { required: true, message: '请输入商品编码', trigger: 'blur' },
        goodsUnit: { required: true },
        thumbnail: { required: true, message: '请选择上传图片' }
      },
      channelId: { '1': '2', '2': '1', '3': '4' },
      unlimited: false, // 不限
      formValidate3: {
        qdName: ['', '一体机', '收银台', '微信商城'][this.$route.query.type], // 销售渠道
        ptPrice: '',
        inventory: '',
        listingAt: '', // 上架时间
        delistingAt: '', // 下架时间
        minNum: ''
      },
      ruleValidate3: {
        qdName: { required: true, message: '销售渠道不能为空', trigger: 'blur' },
        goodsPrice: { required: true, message: '商品价格不能为空', trigger: 'blur' },
        ptPrice: { required: true, message: '平台价格不能为空', trigger: 'blur' },
        listingAt: { required: true, message: '请选择上架时间' },
        delistingAt: {
          required: true,
          validator: (rule, value, callback) => {
            if (!new Date(this.formValidate3.delistingAt).getTime()) {
              callback(new Error('请选择下架时间'))
            } else if (new Date(this.formValidate3.delistingAt).getTime() < new Date(this.formValidate3.listingAt).getTime()) {
              callback(new Error('下架时间不能小于上架时间'))
            } else if (new Date(this.formValidate3.delistingAt).getTime() === new Date(this.formValidate3.listingAt).getTime()) {
              callback(new Error('下架时间不能等于上架时间'))
            } else if (new Date(this.formValidate3.delistingAt).getTime() < new Date().getTime()) {
              callback(new Error('下架时间要大于当前系统时间'))
            } else {
              callback()
            }
          }
        },
        limitUnit: { required: true, message: '请选择购买最少限制', trigger: 'change' },
        minNum: { required: true, message: '请输入购买最少限制', trigger: 'blur' }
      }
    }
  },
  watch: {
    current (val) {
      if (val === 1) {
        this.ids = []
        this.formValidate1.involvedClassify.map(ele => {
          this.ids.push(ele.id)
        })
        if (this.goodsDetail2.length) {
          getMachineList({
            shopId: this.ids.join(',')
          }).then(res => {
            const result = res.data || {}
            if (result.status === 200) {
              this.formatShopProjects(result.data || [])
            } else {
              this.shopProjects = []
              this.formDynamic.list.map(ele => {
                ele.project = []
                ele.projectItems = []
              })
              // if()
              this.$Message.error(`${result.error}`)
            }
          })
        }
      }
      if (val === 3) {
        this.num = 3
        this.timer = setInterval(() => {
          this.num--
          if (this.num === 0) {
            clearInterval(this.timer)
            this.handleReset()
          }
        }, 1000)
      }
    },
    unlimited (val) {
      if (val) {
        this.formValidate3.inventory = ''
        this.resetOneForm2('inventory')
      }
    }
  },
  mounted () {
    this.getList()
    this.getGoodsDetail()
  },
  methods: {
    resetOneForm2 (prop) {
      this.$refs['formValidate3'].fields.forEach(e => {
        if (e.prop === prop) {
          e.resetField()
        }
      })
    },
    // 确认选择
    volumeSetm (obj, item) {
      // console.log('dd', item)
      item.modalShow = false
      // console.log('ff', obj)
      item.project = obj
      item.projectItems = []
      obj.forEach(ele => {
        let obj = { machineName: ele.name, machineId: ele.id, count: '1' }
        item.projectItems.push(obj)
      })
    },
    // 时间
    validStartChange (time) {
      this.validEndOptions = {
        disabledDate (date) {
          if (!time) {
            return date.valueOf() < Date.now() - 86400000
          } else {
            if (new Date(time).getTime() - 24 * 60 * 60 * 1000 < Date.now() - 86400000) {
              return date.valueOf() < Date.now() - 86400000
            } else {
              return date.valueOf() < new Date(time).getTime() - 24 * 60 * 60 * 1000
            }
          }
        }
      }
    },
    validEndChange (time) {
      this.validStartOptions = {
        disabledDate (date) {
          return date.valueOf() > new Date(time).getTime()
        }
      }
    },
    // 上架时间
    listingTimeChange (time) {
      this.delistingTimeOptions = {
        disabledDate (date) {
          if (!time) {
            return date.valueOf() < Date.now() - 86400000
          } else {
            if (new Date(time.split(' ')[0]).getTime() - 24 * 3600 * 1000 < Date.now() - 86400000) {
              return date.valueOf() < Date.now() - 86400000
            } else {
              return date.valueOf() < new Date(time.split(' ')[0]).getTime() - 24 * 3600 * 1000
            }
          }
        }
      }
    },
    delistingTimeChange (time) {
      this.listingTimeOptions = {
        disabledDate (date) {
          return date.valueOf() > new Date(time).getTime()
        }
      }
    },
    // 取消选择
    selctshopCancelm (item) {
      // console.log('yuu', item)
      item.modalShow = false
    },
    formatShopProjects (projects) {
      // console.log('ss', projects)
      this.shopProjects = projects.map(item => {
        item.orgName = item.machineCategoryName
        item.id = item.machineCategoryId
        item.orgType = 0
        item.childList = item.machineDTOs.map(childItem => {
          childItem.id = childItem.machineId
          childItem.orgName = childItem.name
          childItem.parentId = item.machineCategoryId
          childItem.orgType = 1
          childItem.childList = []
          return childItem
        })
        return item
      })
    },
    // 分类选择1
    seletcType () {

    },
    // 分类选择2
    seletcType2 () {

    },
    // 分类选择3
    seletcType3 () {

    },
    // 商品标题
    keyupsubTitle () {

    },
    // 商品名称
    keyupskuName () {

    },
    // 商品条码
    keyup () {

    },
    // 上一步
    skipTwo () {
      this.current--
    },
    // 上一步
    skipThree () {
      this.current--
    },
    // 获取商品详情
    getGoodsDetail () {
      getDetailSysGoodsList({
        merchantId: this.$store.state.user.merchantId,
        sysGoodsId: this.$route.query.sysGoodsId
      }).then(res => {
        if (res.data.status === 200) {
          let result = (res.data.data || {}).goods
          // console.log(result)
          this.involvedTypeList = [result.goodsKindList[0]]
          this.matchClassifyList = [result.goodsKindList[1]]
          if (result.goodsKindList.length === 3) {
            this.mealTypeList = [result.goodsKindList[2]]
            this.formValidate2.mealType = result.goodsKindList[2].typeCode
          }
          if (this.formValidate2.mealType === '010402') {
            let goodsCombo = result.goodsCombo
            goodsCombo.map(ele => {
              this.goodsDetail.push({
                ...ele.goodsDetail,
                num: ele.num,
                saleType: ele.goodsDetail.gameCouponExtra ? ele.goodsDetail.gameCouponExtra.saleType : '',
                relateType: ele.goodsDetail.goodsKindList[0].typeName,
                matchClassify: ele.goodsDetail.goodsKindList[1].typeName,
                goodsPrice: ele.goodsDetail.gameCouponPriceConfig ? ele.goodsDetail.gameCouponPriceConfig.configValue : '',
                games: ele.goodsDetail.gameCouponTimesConfig ? ele.goodsDetail.gameCouponTimesConfig.configValue : '',
                project: [],
                projectItems: [],
                dailyUseLimit: '',
                validType: '2',
                validDays: '',
                validStart: '',
                validEnd: '',
                subSkuId: ele.subSkuId
              })
            })
            this.formDynamic.list = this.goodsDetail
          }
          if (this.formValidate2.mealType === '010403') {
            let goodsCombo1 = result.goodsCombo
            goodsCombo1.map(ele => {
              this.goodsDetail2.push({
                ...ele.goodsDetail,
                num: ele.num,
                saleType: ele.goodsDetail.gameCouponExtra ? ele.goodsDetail.gameCouponExtra.saleType : '',
                relateType: ele.goodsDetail.goodsKindList[0].typeName,
                matchClassify: ele.goodsDetail.goodsKindList[1].typeName,
                goodsPrice: ele.goodsDetail.gameCouponPriceConfig ? ele.goodsDetail.gameCouponPriceConfig.configValue : '',
                games: ele.goodsDetail.gameCouponTimesConfig ? ele.goodsDetail.gameCouponTimesConfig.configValue : '',
                project: [],
                projectItems: [],
                dailyUseLimit: '',
                validType: '2',
                validDays: '',
                validStart: '',
                validEnd: '',
                modalShow: false,
                subSkuId: ele.subSkuId
              })
            })
            this.formDynamic.list = this.goodsDetail2
          }
          this.typeLen = result.goodsKindList.length
          this.formValidate1.involvedType = result.goodsKindList[0].typeCode
          this.formValidate2.productClassify = res.data.data.parentSysCategoryName
          this.formValidate2.productClassify2 = res.data.data.sysCategoryName
          this.formValidate2.goodsType = result.goodsType
          this.formValidate2.relateType = result.goodsKindList[0].typeCode
          this.formValidate2.matchClassify = result.goodsKindList[1].typeCode
          this.formValidate2.coinNum = result.goodsCombo.length > 0 ? result.goodsCombo[0].num : ''
          this.formValidate2.exchangeNum = result.goodsCombo.length > 0 ? result.goodsCombo[0].num + '' : ''
          this.formValidate2.goodsNum = '1'
          this.formValidate2.subTitle = result.subTitle
          this.formValidate2.skuName = result.skuName
          this.formValidate2.barcode = result.barcode
          this.formValidate2.skuId = result.skuId
          this.formValidate2.goodsUnit = result.goodsUnit
          this.formValidate2.thumbnail = result.thumbnail
        } else {
          this.$Message.error(`${res.data.error}`)
        }
      })
    },
    // 获取门店列表
    getList () {
      getOrgAllTree({
        'merchantId': this.$store.state.user.merchantId,
        orgType: 1,
        status: 1,
        perms: 'moms:product:coinview',
        id: this.$store.state.user.orgId
      }).then(res => {
        if (res.data.status === 200) {
          this.dataTree = [res.data.data]
          this.changeTitle(this.dataTree)
          this.lowerDimension(this.dataTree)
        } else {
          this.$Message.error(`${res.data.error}`)
        }
      }).catch(err => {
        this.$Message.error(`${err}`)
      })
    },
    // 获取所选分类列表
    volumeSet (val) {
      this.checkdList = val
      this.formValidate1.involvedClassify = val
      // console.log(val)
    },
    // 取消后的selce
    oncancel (val) {
      this.checkdList = val
      this.formValidate1.involvedClassify = val
    },
    // 设置checked
    changeTitle (arr) {
      arr.forEach(item => {
        this.$set(item, 'checked', false)
        if (item.hasOwnProperty('childList') && item.childList.length > 0) {
          this.changeTitle(item.childList)
        }
      })
    },
    lowerDimension (arr) {
      arr.forEach(item => {
        if (Array.isArray(item.childList) && item.childList.length) {
          this.lowerDimension(item.childList)
        } else if (item.orgType === 1) {
          this.dataTreeFormat.push(item)
        }
      })
    },
    // 第一步提交
    submitOne () {
      this.$refs.formValidate1.validate((valid) => {
        if (valid) {
          if (this.current === 3) {
            this.current = 0
          } else {
            this.current += 1
          }
        }
      })
    },
    // 选择可选项目
    selectProject (item) {
      if (!this.shopProjects.length) {
        this.$Message.error('该门店没有项目')
      } else {
        item.modalShow = true
      }
    },
    deleteProject (item, index, obj, tt, res, resd) {
      obj.splice(index, 1)
      resd.projectItems.splice(index, 1)
    },
    // 第二步提交
    submitTwo () {
      this.$refs.formValidate2.validate((val) => {
        if (val) {
          if (this.formDynamic.list.length) {
            this.$refs.formDynamic.validate((valid) => {
              if (valid) {
                if (this.formValidate2.mealType === '010403') {
                  this.packagesArr = []
                  this.formDynamic.list.map(ele => {
                    console.log(ele.goodsKindList[1].typeCode)
                    if (ele.goodsKindList[1].typeCode === '0201') {
                      this.packagesArr.push({
                        goodsPrice: ele.num,
                        games: ele.games,
                        projectItems: ele.projectItems
                      })
                    }
                  })
                  if (this.packagesArr.length > 0) {
                    let index = 0
                    this.packagesArr.forEach(ele => {
                      let cot = 0
                      let amount = Number(ele.games) * Number(ele.goodsPrice)
                      ele.projectItems.forEach(elt => {
                        cot += Number(elt.count)
                      })
                      if (amount === cot) {
                        index++
                      }
                    })
                    if (index === this.packagesArr.length) {
                      if (this.current === 3) {
                        this.current = 0
                      } else {
                        this.current += 1
                      }
                    } else {
                      this.$Message.error('机台局数总和必须与游戏券局数相等')
                    }
                  } else {
                    if (this.current === 3) {
                      this.current = 0
                    } else {
                      this.current += 1
                    }
                  }
                } else {
                  if (this.current === 3) {
                    this.current = 0
                  } else {
                    this.current += 1
                  }
                }
              }
            })
          } else {
            if (this.current === 3) {
              this.current = 0
            } else {
              this.current += 1
            }
          }
        }
      })
    },
    exchangeNumkeyup () {
      if (this.formValidate2.exchangeNum.length === 1) {
        this.formValidate2.exchangeNum = this.formValidate2.exchangeNum.replace(/^[^\d]+/g, '')
      } else {
        this.formValidate2.exchangeNum = this.formValidate2.exchangeNum.replace(/^(0+)|[^\d]+/g, '')
      }
    },
    exchangeNumblur () {
      this.formValidate2.exchangeNum = this.formValidate2.exchangeNum.replace(/^[^\d]+/g, '')
    },
    // 每天使用局数设置
    dailyUsekeyup (val, item) {
      if (val.length === 1) {
        val = val.replace(/^[^\d]+/g, '')
        this.$set(item, 'dailyUseLimit', val.replace(/^[^\d]+/g, ''))
      } else {
        this.$set(item, 'dailyUseLimit', val.replace(/^(0+)|[^\d]+/g, ''))
      }
    },
    dailyUseblur (val, item) {
      val = val.replace(/^[^\d]+/g, '')
      this.$set(item, 'dailyUseLimit', val.replace(/^[^\d]+/g, ''))
    },
    validDayskeyup (val, item) {
      val = val.replace(/^(0+)|[^\d]+/g, '')
      this.$set(item, 'validDays', val.replace(/^(0+)|[^\d]+/g, ''))
    },
    validDaysblur (val, item) {
      val = val.replace(/^(0+)|[^\d]+/g, '')
      this.$set(item, 'validDays', val.replace(/^(0+)|[^\d]+/g, ''))
    },
    projectItemskeyup (val, item) {
      if (val.length === 1) {
        val = val.replace(/^[^\d]+/g, '')
        this.$set(item, 'count', val.replace(/^[^\d]+/g, ''))
      } else {
        this.$set(item, 'count', val.replace(/^(0+)|[^\d]+/g, ''))
      }
    },
    projectItemsblur (val, item) {
      val = val.replace(/^[^\d]+/g, '')
      this.$set(item, 'count', val || '0')
    },
    ptPricekeyup () {
      if (this.formValidate3.ptPrice !== '' && this.formValidate3.ptPrice.substring(0, 1) === '.') {
        this.formValidate3.ptPrice = ''
      }
      this.formValidate3.ptPrice = this.formValidate3.ptPrice.replace(/^0*(0\.|[1-9])/, '$1') // 粘贴不生效
      this.formValidate3.ptPrice = this.formValidate3.ptPrice.replace(/[^\d.]/g, '') // 清除“数字”和“.”以外的字符
      this.formValidate3.ptPrice = this.formValidate3.ptPrice.replace(/\.{2,}/g, '.') // 只保留第一个. 清除多余的
      this.formValidate3.ptPrice = this.formValidate3.ptPrice.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')
      this.formValidate3.ptPrice = this.formValidate3.ptPrice.replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') // 只能输入两个小数
      if (this.formValidate3.ptPrice.indexOf('.') < 0 && this.formValidate3.ptPrice !== '') { // 以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
        if (this.formValidate3.ptPrice.substring(0, 1) === '0' && this.formValidate3.ptPrice.length === 2) {
          this.formValidate3.ptPrice = this.formValidate3.ptPrice.substring(1, this.formValidate3.ptPrice.length)
        }
      }
      if (this.formValidate3.ptPrice > 9999999.99) {
        this.formValidate3.ptPrice = this.formValidate3.ptPrice.substring(0, 7)
      }
    },
    ptPriceblur () {
      this.formValidate3.ptPrice = this.formValidate3.ptPrice + ''
      this.formValidate3.ptPrice = this.formValidate3.ptPrice.replace(/[^\d.]/g, '')
      if (this.formValidate3.ptPrice === '') {
        this.formValidate3.ptPrice = ''
      } else if (this.formValidate3.ptPrice.indexOf('.') === -1) {
        this.formValidate3.ptPrice = this.formValidate3.ptPrice + '.00'
      } else if (this.formValidate3.ptPrice.indexOf('.')) {
        let ste = this.formValidate3.ptPrice.substring(this.formValidate3.ptPrice.indexOf('.') + 1)
        if (!ste) {
          this.formValidate3.ptPrice = this.formValidate3.ptPrice + '00'
        }
        if (ste.length === 1) {
          this.formValidate3.ptPrice = this.formValidate3.ptPrice + '0'
        } if (ste.length > 2) {
          this.formValidate3.ptPrice = this.formValidate3.ptPrice.substring(0, this.formValidate3.ptPrice.indexOf('.') + 3)
        }
      }
    },
    inventorykeyup () {
      if (this.formValidate3.inventory.length === 1) {
        this.formValidate3.inventory = this.formValidate3.inventory.replace(/^[^\d]+/g, '')
      } if (this.formValidate3.inventory.length > 1) {
        this.formValidate3.inventory = this.formValidate3.inventory.replace(/^(0+)|[^\d]+/g, '')
      }
      if (this.formValidate3.minNum.length === 1) {
        this.formValidate3.minNum = this.formValidate3.minNum.replace(/^[^\d]+/g, '')
      } if (this.formValidate3.minNum.length > 1) {
        this.formValidate3.minNum = this.formValidate3.minNum.replace(/^(0+)|[^\d]+/g, '')
      }
    },
    inventoryblur () {
      this.formValidate3.inventory = this.formValidate3.inventory.replace(/^[^\d]+/g, '')
      this.formValidate3.minNum = this.formValidate3.minNum.replace(/^[^\d]+/g, '')
    },
    // 第三步提交
    submitThree () {
      this.$refs.formValidate3.validate((val) => {
        if (val) {
          let shopId = []
          this.formValidate1.involvedClassify.forEach(ele => {
            shopId.push(ele.id)
          })
          if (this.subTrue) {
            this.subTrue = false
            createChannelList({
              merchantId: this.$store.state.user.merchantId,
              channelId: this.channelId[this.$route.query.type],
              shopId: shopId.join(','),
              sysGoodsId: this.$route.query.sysGoodsId,
              sysId: 'xsxt',
              title: this.formValidate2.subTitle,
              thumbnail: this.formValidate2.thumbnail,
              listingAt: dayjs(this.formValidate3.listingAt).format('YYYY-MM-DD HH:mm:ss'),
              delistingAt: dayjs(this.formValidate3.delistingAt).format('YYYY-MM-DD HH:mm:ss'),
              creator: this.$store.state.user.userId,
              creatorName: this.$store.state.user.userName,
              inventory: this.unlimited ? '-1' : this.formValidate3.inventory,
              minNum: this.formValidate3.minNum,
              goodsPrices: [
                { priceType: 0, priceCategory: 1, amount: this.formValidate3.ptPrice }
              ],
              subChannelGameCoupons: this.formDynamic.list.map(ele => {
                if (ele.goodsKindList[1].typeCode === '0201') {
                  return {
                    // limitUnit: ele.limitUnit,
                    // amountLimit: ele.amountLimit,
                    subSkuId: ele.subSkuId,
                    validType: ele.validType,
                    validDays: ele.validDays,
                    validStart: ele.validStart ? dayjs(ele.validStart).format('YYYY-MM-DD 00:00:00') : '',
                    validEnd: ele.validEnd ? dayjs(ele.validEnd).format('YYYY-MM-DD 00:00:00') : '',
                    dailyUseLimit: ele.dailyUseLimit,
                    machineDetail: ele.projectItems
                  }
                } else {
                  return {
                    subSkuId: ele.subSkuId,
                    validType: ele.validType,
                    validDays: ele.validDays,
                    validStart: ele.validStart ? dayjs(ele.validStart).format('YYYY-MM-DD 00:00:00') : '',
                    validEnd: ele.validEnd ? dayjs(ele.validEnd).format('YYYY-MM-DD 00:00:00') : '',
                    dailyUseLimit: ele.dailyUseLimit,
                    machineDetail: ele.projectItems.map(elt => {
                      return {
                        machineName: elt.machineName,
                        machineId: elt.machineId
                      }
                    })
                  }
                }
              }).filter(ele => ele.machineDetail.length > 0)
            }).then(res => {
              if (res.data.status === 200) {
                setTimeout(() => {
                  this.subTrue = true
                }, 1000)
                this.$Message.success('上架成功')
                if (this.current === 3) {
                  this.current = 0
                } else {
                  this.current += 1
                }
              } else {
                setTimeout(() => {
                  this.subTrue = true
                }, 1000)
                this.$Message.error(`${res.data.error}`)
              }
            })
          }
        }
      })
    },
    // 返回商品列表
    skipList () {
      clearInterval(this.timer)
      this.handleReset()
    },
    handleReset () {
      this.$store.commit('closeTag', this.$route)
      // this.$store.commit('setTagNavList', this.$store.state.app.tagNavList.filter(item => !routeEqual(this.$route, item)))
      if (this.$store.state.app.tagNavList[this.$store.state.app.tagNavList.length - 1].name !== 'game_currency_aio') {
        this.$nextTick(() => {
          this.$router.push({
            name: 'game_currency_aio',
            query: { id: this.$route.query.id, sysId: this.$route.query.sysId, type: this.$route.query.type, sysGoodsId: this.$route.query.sysGoodsId }
          })
        })
      }
    }
  }
}
</script>
<style lang="less">
.game_currency_putaway {
  .tag-container {
    display: flex;
    flex-wrap: wrap;
    min-height: 32px;
    padding: 0px 7px;
    min-width: 280px;
    border: 1px solid #dcdee2;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
    &.setting {
      background: #f8f8f9;
      padding: 10px 30px 0 10px;
      .ivu-form {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        width: 100%;
        input,
        .ivu-form-item-content {
          display: flex;
          justify-content: space-between;
          align-items: center;
          width: 80px;
        }
        .ivu-form-item {
          display: flex;
          justify-content: space-between;
          align-items: center;
          margin-bottom: 10px;
          margin-right: 50px;
          &:nth-child(3n) {
            margin-right: 0;
          }
        }
        .ivu-form-item-label {
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
        }
      }
    }
  }
  .first-level {
    position: relative;
    .involveds-box {
      width: 580px;
      height: 286px;
    }
    #involveds {
      position: absolute;
      left: 75px;
      top: 104px;
      z-index: 1000;
      // display: none;
    }
  }
  .shops {
    font-size: 12px;
    color: #808695;
    line-height: 17px;
    margin-top: 16px;
    .shop-items {
      // color: rgb(242, 90, 83);
      display: inline-block;
      vertical-align: top;
      width: 300px;
      height: 17px;
      line-height: 17px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
  .prev {
    width: 31% !important;
  }
  .complate {
    width: 7% !important;
  }
  .content-style {
    margin: 0 auto !important;
  }
  .title {
    display: flex;
    margin-bottom: 30px;
    p {
      width: 8px;
      height: 20px;
      background: #2d8cf0;
      margin-right: 10px;
    }
  }
  .child-items {
    // font-size: 14px;
    // color: #464c5b;
    letter-spacing: 0;
    padding-left: 18px;
    line-height: 20px;
    margin-top: 32px;
    margin-bottom: 20px;
  }
  .project-items {
    width: 745px;
    background: #f8f8f9;
    border: 1px solid #e9e9e9;
    padding: 20px 10px;
    border-radius: 3px;
    .project-items-its {
      width: 250px;
      margin-bottom: 10px;
      display: inline-block;
      .project-items-items {
        display: inline-block;
        width: 100px;
      }
    }
  }
}
</style>
<style>
</style>
